home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: MegaDisc / MegaDisc 27 (1992-03)(MegaDisc Digital Publishing)(AU)(Disk 2 of 2).zip / MegaDisc 27 (1992-03)(MegaDisc Digital Publishing)(AU)(Disk 2 of 2).adf / AMOS / Dos_in_AMOS / Dos_in_AMOS
Text File  |  1992-03-30  |  21KB  |  653 lines

  1.  
  2.                 Using AmigaDOS From Within AMOS
  3.  
  4.                         by Graham Clowes
  5.  
  6.  
  7.    Bio-pic:
  8.  
  9.    I am an electrician by trade with an Industrial Electronics Diploma, but
  10.   have not worked in either of these fields for more than a decade. My
  11.   present position is Production Officer with Pacific Power. I am one of
  12.   those people dedicated to ensuring that there is plenty of power to keep
  13.   our Amigas running long into the night. I built my first computer back in
  14.   the early seventies when integrated circuits were a relatively new
  15.   technology from a kit provided by Dick Smith Electronics. It had a massive
  16.   256 bytes of memory and was programmed by rows of switches on the front
  17.   panel. How things have progressed! I now own two Amigas a 500 and a 2000
  18.   each with a 20meg hd and 3 megs. My interests at present are turning
  19.   towards graphics digitising and 24bit in particular.  My aim is to begin a
  20.   library of images and history of the Lithgow and Illawarra regions and
  21.   perhaps progress from there. It depends a lot on time, which I will not
  22.   have much of during the next 4-6 months. I have recently developed an
  23.   interest in 'C' so any articles you may provide on this topic will be most
  24.   avidly read.  Keep up the good work and hopefully it won't be too long
  25.   before I have something else to send.
  26.  
  27.  
  28.    (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 ))
  29.  
  30.  
  31.  
  32.    On careful reading of the AMOS manual, you will find at the back of the
  33.   book a section on accessing the system libraries. These functions enable
  34.   you to utilise the Amiga's internal system libraries. One of these
  35.   libraries is the 'dos.library'. This library provides communication with
  36.   the disk drives and the hard disk. It also enables you to open windows in
  37.   the CLI environment and communicate with the user without opening an AMOS
  38.   screen. By combining these features it is a relatively simple matter to
  39.   communicate with the DOS to provide features not provided by AMOS.
  40.  
  41.    Provided here are a number of procedures which may be included in your own
  42.   programs or used as accessories to provide some of the workbench disk
  43.   functions. This is by no means an exhaustive list of the functions
  44.   available to you. You should experiment and find out which functions are
  45.   of use to you. By using the Execute function in the 'dos.library' you will
  46.   be able to utilise most of the commands in the 'c' drawer, but remember, if
  47.   the command needs user input you will need to open a window as shown in the
  48.   example to format a disk. The various library offsets and system constants
  49.   can be obtained from the  AMIGA ROM KERNEL REFERENCE MANUAL.
  50.  
  51.  
  52.  
  53.  
  54.     Formatting a Disk
  55.  
  56.    You will need the 'Format' command in the System drawer to use the
  57.   procedure described below. This procedure may be used in your own programs
  58.   or loaded as an accessory.
  59.  
  60.    The first requirement is a window; as the AmigaDOS Format command, as
  61.   provided in the system drawer of your workbench disk, needs to tell you
  62.   what's going on.
  63.  
  64.     Amos To Back    First let's move AMOS to the back so we can see our
  65.             window.
  66.  
  67.     _MODE_OLD=1005  Mode old should be used when opening a window. If you
  68.     _OPEN=-30       are opening a new file on disk, you should use mode new
  69.     _CLOSE=-36      1006. _OPEN, _CLOSE and _EXECUTE are the dos.library
  70.     _EXECUTE=-222   offsets. These figures can be obtained from the 'Amiga
  71.             ROM KERNEL Reference Manual'.
  72.  
  73.     FILE$="CON:66/10/508/50/** AMOS Format    G Clowes 22-12-91 **"
  74.  
  75.           Our window will need a name. We will use the variable FILE$ to
  76.           hold this. The name consists of:-
  77.             the kind of device we are opening  -> 'CON:'
  78.             the top left corner of the window  -> '66','10'
  79.             the size of the window   -----------> '508' by '50'
  80.             and finally the name itself.
  81.           The backslash '/' is just to separate the various values.
  82.  
  83.    Dreg(1)=Varptr(FILE$)    Now the DOS must be told where our command is.
  84.                 We pass the address of the variable FILE$ to
  85.                 data register D1, an internal register of the
  86.                 CPU.
  87.  
  88.    Dreg(2)=_MODE_OLD        Next we tell DOS what Mode to use. We pass this
  89.                 value on to data register D2.
  90.  
  91.    _WINDOW=Doscall(_OPEN)   The 'dos.library' now has the information it
  92.                 requires to successfully open our window. If the
  93.                 function was successful it will return the
  94.                 address of our window. This is known as the
  95.                 filehandle. If our window failed to open, a zero
  96.                 would be returned.
  97.    If _WINDOW=0 Then Pop Proc
  98.                 Obviously if we have not been able to open a
  99.                 window we can not continue. Exit the procedure.
  100.  
  101.  
  102.    COMMAND$="System/Format DRIVE "+DISK$+" NAME "+NAME$
  103.                 Once we have our window, we can proceed to
  104.                 format the disk. We will use the variable
  105.                 COMMAND$ to hold the command we wish to execute.
  106.  
  107.    If Not ICONS Then COMMAND$=COMMAND$+" NOICONS"
  108.                 If the variable ICONS=False then we add
  109.                 'NOICONS' to the end of our command string. This
  110.                 prevents the placing of the Trashcan folder on
  111.                 the disk.
  112.  
  113.    Dreg(1)=Varptr(COMMAND$) Tell DOS where our command is. This is
  114.                 passed to data register D1.
  115.  
  116.    Dreg(2)=0            We should tell the function where its input
  117.                 should come from. In this case we won't bother as
  118.                 it's not really required. But if you need user
  119.                 input you would place the filehandle of the
  120.                 window here.
  121.  
  122.    Dreg(3)=_WINDOW          The DOS will need to know where to send its
  123.                 output. In this case we give it the filehandle
  124.                 of our window.
  125.  
  126.    R=Doscall(_EXECUTE)      Execute the command. This function is similar to
  127.                 the 'run' command you would use from the CLI.
  128.                 'R' will equal zero if the function failed.
  129.  
  130.    Dreg(1)=_WINDOW          After we have formatted our disk, we will no
  131.                 longer need the window. We pass the handle of
  132.                 the window in data register D1.
  133.  
  134.    R=Doscall(_CLOSE)        This call now closes the window.
  135.  
  136.    Amos To Front            Now let's get back to AMOS and some serious
  137.                 programming.
  138.  
  139.  
  140.     DISK$ = The disk drive you wish to format
  141.     NAME$ = The Name you wish to give the disk.
  142.     ICONS = True     disk will have a trashcan.
  143.         False    disk will not have a trashcan.
  144.  
  145.  
  146.  
  147.     e.g. _FORMAT["df1:","TESTING",False]
  148.  
  149.  
  150. ===================================================================
  151.  
  152.     To include in your own programs, simply cut and merge as
  153.     ASCII.
  154.  
  155.  
  156. Procedure _FORMAT[DISK$,NAME$,ICONS]
  157.    Amos To Back
  158.    _MODE_OLD=1005
  159.    _OPEN=-30
  160.    _CLOSE=-36
  161.    _EXECUTE=-222
  162.    FILE$="CON:66/10/508/50/** AMOS Format    G Clowes 22-12-91 **"
  163.    Dreg(1)=Varptr(FILE$)
  164.    Dreg(2)=_MODE_OLD
  165.    _WINDOW=Doscall(_OPEN)
  166.    If _WINDOW=0 Then Pop Proc
  167.    COMMAND$="System/Format DRIVE "+DISK$+" NAME "+NAME$
  168.    If Not ICONS Then COMMAND$=COMMAND$+" NOICONS"
  169.    Dreg(1)=Varptr(COMMAND$)
  170.    Dreg(2)=0
  171.    Dreg(3)=_WINDOW
  172.    R=Doscall(_EXECUTE)
  173.    Dreg(1)=_WINDOW
  174.    R=Doscall(_CLOSE)
  175.    Amos To Front
  176. End Proc
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.     Getting the System Time
  184.  
  185.     AmigaBASIC provides the functions 'DATE$' and "TIME$' to retrieve the
  186.     system date and time. Unfortunately these facilities are not available
  187.     in AMOS. There is however a 'Date' command in the 'C' drawer and, as
  188.     noted above, AMOS provides easy access to the 'dos.library' to enable
  189.     us to use this command. The system time can also be found by use of the
  190.     DateStamp function, but we will look at that later.
  191.  
  192.    _MODE_NEW=1006           Mode new (1006) should be used when opening a
  193.    _OPEN=-30            new file. _OPEN, _CLOSE and _EXECUTE are the
  194.    _CLOSE=-36           dos.library functions we will use.
  195.    _EXECUTE=-222
  196.  
  197.    TEMP$="RAM:Date"         The AmigaDOS 'Date' command needs somewhere to
  198.                 send its output. We will therefore open a
  199.                 temporary file on the RAM DISK.
  200.  
  201.    Dreg(1)=Varptr(TEMP$)    Tell DOS about our file name. Pass the address
  202.                 of the variable TEMP$ in data register D1.
  203.  
  204.    Dreg(2)=_MODE_NEW        Which mode shall we require? Let's place that
  205.                 in data register D2.
  206.  
  207.    FILEHANDLE=Doscall(_OPEN)
  208.                 The 'dos.library' now has the information it
  209.                 requires to successfully open our file. If it
  210.                 was successful the filehandle will be returned
  211.                 in the variable FILEHANDLE.
  212.    If FILEHANDLE=0 Then Pop Proc
  213.                 If we failed to open a file then we can not
  214.                 continue so exit the procedure.
  215.  
  216.    COMMAND$="Date"          We will use the variable COMMAND$ to hold the
  217.                 command we wish to execute.
  218.  
  219.    Dreg(1)=Varptr(COMMAND$) Tell DOS where our command is and place it in
  220.                 data register D1.
  221.  
  222.    Dreg(2)=0            Give the DOS the handle of the Input channel. In
  223.                 this case a zero in data register D2.
  224.  
  225.    Dreg(3)=FILEHANDLE       The DOS will need to know where to send its
  226.                 output. In this case we give it the filehandle
  227.                 of our temporary file in RAM:.
  228.  
  229.    RESULT=Doscall(_EXECUTE) Execute the command. RESULT will equal zero if
  230.                 the function failed.
  231.  
  232.    Dreg(1)=FILEHANDLE       Now that AmigaDOS is finished with our temporary
  233.                 file we can close it. This does not erase the
  234.    R=Doscall(_CLOSE)        file, but makes it available for AMOS to read it
  235.                 to obtain the time.
  236.  
  237.    Set Input 10,-1          AMOS uses both a Return and a line feed at the
  238.                 end of each line. AmigaDOS uses only a line feed
  239.                 . Therefore we must tell AMOS to expect only a
  240.                 line feed at the end of each line other wise it
  241.                 gets confused.
  242.  
  243.    If RESULT<>0         If RESULT does not equal zero then the 'Execute'
  244.       Open In 1,TEMP$       function succeeded and we will have something
  245.       Line Input #1,TIME$   worthwhile to read in our temporary file.
  246.       Close 1
  247.    Else
  248.       TIME$=""          If RESULT equals zero then the call failed and
  249.    End If               our temporary file will be empty.
  250.  
  251.    Kill TEMP$           We will no longer require the temporary file so
  252.                 lets erase it.
  253.  
  254. End Proc[TIME$]         The procedure returns the system time given by
  255.                 the Date command.
  256.  
  257.  
  258.  
  259.  
  260.     e.g. TIME
  261.      Print Param$
  262.  
  263.  
  264. ===================================================================
  265.  
  266.     To include in your own programs, simply cut and merge as
  267.     ASCII.
  268.  
  269.  
  270.  
  271. Procedure TIME
  272.    _MODE_NEW=1006
  273.    _OPEN=-30
  274.    _CLOSE=-36
  275.    _EXECUTE=-222
  276.    TEMP$="RAM:Date"
  277.    Dreg(1)=Varptr(TEMP$)
  278.    Dreg(2)=_MODE_NEW
  279.    FILEHANDLE=Doscall(_OPEN)
  280.    If FILEHANDLE=0 Then Pop Proc
  281.    COMMAND$="Date"
  282.    Dreg(1)=Varptr(COMMAND$)
  283.    Dreg(2)=0
  284.    Dreg(3)=FILEHANDLE
  285.    RESULT=Doscall(_EXECUTE)
  286.    Dreg(1)=FILEHANDLE
  287.    R=Doscall(_CLOSE)
  288.    Set Input 10,-1
  289.    If RESULT<>0
  290.       Open In 1,TEMP$
  291.       Line Input #1,TIME$
  292.       Close 1
  293.    Else
  294.       TIME$=""
  295.    End If
  296.    Kill TEMP$
  297. End Proc[TIME$]
  298.  
  299.     DateStamp
  300.  
  301.     As previously mentioned there is another way to get the system time by
  302.     utilising the 'dos.library'. This method requires considerably more
  303.     effort. For an output similar to the AmigaDOS 'Date' command a number of
  304.     arrays are required to be filled and a number of calculations are
  305.     required to convert the three numbers returned by DateStamp into a
  306.     recognisable date format. The following procedures return the date as
  307.  
  308.         Monday 28-Feb-91 15:32:34
  309.  
  310.     The 'dos.library' function DateStamp returns the system time as three
  311.     long words, that is three 32 bit numbers. The first number contains
  312.     the number of days since the first of January 1978. The second holds
  313.     the number of minutes since midnight and the last the number of ticks
  314.     since the last full minute. One tick is 1/60 of a second. This method
  315.     has the advantage of not requiring the Date command from the System
  316.     disk.
  317.  
  318.     Dim TIME(3)         We need an array to hold the three 32 bit
  319.                 numbers returned by DateStamp.
  320.  
  321.     DATESTAMP=-192          The 'dos.library' offset for DateStamp is -192.
  322.  
  323.     Dreg(1)=Varptr(TIME(1)) DateStamp will need to know where to place the
  324.                 date.
  325.  
  326.     R=Doscall(DATESTAMP)    The call to DateStamp fills the array TIME()
  327.                 with the current system time.
  328.  
  329.     The procedure CALC_DATE converts the date returned by DateStamp into
  330.     the format described above. The calculations required to perform the
  331.     transformation I found in the 'Advanced System Programmer's Guide' by
  332.     Abacus and I converted the 'C' code over to AMOS.
  333.  
  334.  
  335.  
  336.  
  337. ===================================================================
  338.  
  339.     To include in your own programs, simply cut and merge as
  340.     ASCII.
  341.  
  342.  
  343.  
  344. Dim TIME(3)
  345. Dreg(1)=Varptr(TIME(1))
  346. R=Doscall(-192)
  347.  
  348. CALC_DATE
  349. Print Param$
  350. '
  351. Procedure CALC_DATE
  352.    Shared TIME()
  353.    Data "Jan",31,"Feb",28,"Mar",31,"Apr",30,"May",31,"Jun",30,"Jul",31,"Aug",31
  354.    Data "Sep",30,"Oct",31,"Nov",30,"Dec",31
  355.    Data "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
  356.    '
  357.    R=0
  358.    DAYS_1980=2*365
  359.    '
  360.    '
  361.    Dim NAMES_OF_MONTH$(12),DAYS_OF_MONTHS(12),DAYS_OF_WEEK$(7)
  362.    For X=1 To 12
  363.       Read NAMES_OF_MONTH$(X)
  364.       Read DAYS_OF_MONTHS(X)
  365.    Next X
  366.    For X=1 To 7
  367.       Read DAYS_OF_WEEK$(X)
  368.    Next X
  369.    '
  370.    '
  371.    '
  372.    '
  373.    HOURS=TIME(2)/60
  374.    _MINUTES=TIME(2) mod 60
  375.    SECONDS=TIME(3) mod 60
  376.    If TIME(1)>DAYS_1980
  377.       Add TIME(1),-DAYS_1980
  378.       YEAR=1980
  379.    Else
  380.       YEAR=1978
  381.       If TIME(1)>365
  382.      Add TIME(1),-365
  383.      Inc YEAR
  384.       End If
  385.       Goto _GET_MONTH
  386.    End If
  387.    For LEAP_YEAR=1 To 33
  388.       If TIME(1)>366
  389.      Add TIME(1),-366
  390.      Inc YEAR
  391.       End If
  392.       For YRS=1 To 3
  393.      If TIME(1)>365
  394.         Add TIME(1),-365
  395.         Inc YEAR
  396.      End If
  397.       Next YRS
  398.    Next LEAP_YEAR
  399.    Proc LEAPYEAR[YEAR]
  400.    If Param=True Then DAYS_OF_MONTHS(2)=29
  401.    _GET_MONTH:
  402.    MONTH=1
  403.    For X=1 To 12
  404.       If TIME(1)>DAYS_OF_MONTHS(X)
  405.      Add TIME(1),-DAYS_OF_MONTHS(X)
  406.      Inc MONTH
  407.       Else
  408.      Exit
  409.       End If
  410.    Next X
  411.    DATE=TIME(1)+1
  412.    DAY=DATE mod 7
  413.    DATE$=Str$(DATE)-" " : If Len(DATE$)<2 Then DATE$="0"+DATE$
  414.    DATE$=DAYS_OF_WEEK$(DAY)+" "+DATE$+"-"+NAMES_OF_MONTH$(MONTH)+"-"+Right$(Str$(YEAR),2)
  415.    HOUR$=Str$(HOURS)-" " : If Len(HOUR$)<2 Then HOUR$="0"+HOUR$
  416.    _MIN$=Str$(_MINUTES)-" " : If Len(_MIN$)<2 Then _MIN$="0"+_MIN$
  417.    SEC$=Str$(SECONDS)-" " : If Len(SEC$)<2 Then SEC$="0"+SEC$
  418.    TIME$=DATE$+"  "+HOUR$+":"+_MIN$+":"+SEC$
  419. End Proc[TIME$]
  420. '
  421. Procedure LEAPYEAR[YEAR]
  422.    If(YEAR/4)*4=YEAR and(YEAR/100)*100=YEAR Then FLAG=True Else FLAG=False
  423. End Proc[FLAG]
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.     Examine
  444.  
  445.     This function fills a structure referred to as a File Info Block and
  446.     retrieves information about the file or drawer requested. The
  447.     information supplied contains data such as file type, file size or
  448.     creation date etc. The three 32 bit numbers which contain the creation
  449.     date can be placed in the array TIME() and the Procedure CALC_DATE can
  450.     be used to convert them.
  451.  
  452.    Reserve As Work 10,260   We require 260 bytes of memory for the File
  453.                 Info Block.
  454.  
  455.    _MODE=-2             There are two types of locks: reading or
  456.                 writing. We set the mode to ACCESS_READ
  457.                 which is equal to -2.
  458.  
  459.    _EXAMINE=-102            The Examine function 'dos.library' offset is
  460.                 -102.
  461.  
  462.    _LOCK=-84            The Lock function 'dos.library' offset is -84.
  463.  
  464.    _UNLOCK=-90          The UnLock function 'dos.library' offset is -90.
  465.  
  466.    Dreg(1)=Varptr(NAME$)    Put the address of the variable NAME$ in data
  467.                 register D1. NAME$ holds the name of the file or
  468.                 drawer we wish to examine.
  469.  
  470.    Dreg(2)=Varptr(_MODE)    Put the access mode into data register D2.
  471.  
  472.    FILELOCK=Doscall(_LOCK)  Call Lock. FILELOCK should now hold the lock to
  473.                 the file we require. This prevents other
  474.                 programs from altering our file while we have
  475.                 access.
  476.  
  477.    Dreg(1)=FILELOCK         Place this lock into register D1.
  478.  
  479.    Dreg(2)=Start(10)        Tell the function where to place the File Info
  480.                 Block.
  481.  
  482.    R=Doscall(_EXAMINE)      Call Examine. The 260 bytes reserved in Bank 10
  483.                 should now contain the data retrieved about our
  484.                 file by the Examine function.
  485.  
  486.    DREG(1)=FILELOCK         Once we have finished with the file it is
  487.                 considered polite to release our lock and thus
  488.    R=Doscall(_UNLOCK)       give other programs full access to it.
  489.  
  490.  
  491.  
  492.   e.g.
  493.     EXAMINE["AMOS1.3"]
  494.     '
  495.     TIME(1)=Leek(Start(10)+132)
  496.     TIME(2)=Leek(Start(10)+136)
  497.     TIME(3)=Leek(Start(10)+140)
  498.     CALC_DATE
  499.     Print "Creation Date :-";Param$
  500.     '
  501.     Print "FileName  :   ";
  502.     For X=8 To 108
  503.          Print Chr$(Peek(Start(10)+X));
  504.     Next
  505.     Print
  506.     Print "Disk Key  : ";Leek(Start(10))
  507.     Print "Dir Type  : ";Leek(Start(10)+4)
  508.     Print "Protection: ";Bin$(Leek(Start(10)+116),8)-"%"
  509.     Print "Entry Type: ";Leek(Start(10)+120)
  510.     Print "File Size : ";Leek(Start(10)+124)
  511.     Print "Num Blocks: ";Leek(Start(10)+128)
  512.  
  513.  
  514.  
  515. ===================================================================
  516.  
  517.     To include in your own programs, simply cut and merge as
  518.     ASCII.
  519.  
  520.  
  521.  
  522. Procedure EXAMINE[NAME$]
  523.    Erase 10
  524.    Reserve As Work 10,260
  525.    _MODE=-2
  526.    _EXAMINE=-102
  527.    _LOCK=-84
  528.    _UNLOCK=-90
  529.    Dreg(1)=Varptr(NAME$)
  530.    Dreg(2)=Varptr(_MODE)
  531.    FILELOCK=Doscall(_LOCK)
  532.    If FILELOCK
  533.       Dreg(1)=FILELOCK
  534.       Dreg(2)=Start(10)
  535.       R=Doscall(_EXAMINE)
  536.       DREG(1)=FILELOCK
  537.       R=Doscall(_UNLOCK)
  538.    End If
  539. End Proc
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.     Info
  560.  
  561.     This function provides such information as disk size and the number of
  562.     blocks used or free and places it in a structure referred to as an
  563.     InfoData structure.
  564.  
  565.     Reserve As Work 10,40   We require 40 bytes of memory for the
  566.                 InfoData structure.
  567.  
  568.    _MODE=-2             There are two types of locks: reading or
  569.                 writing. We set the mode to ACCESS_READ
  570.                 which is equal to -2.
  571.  
  572.    _INFO=-114           The Info function 'dos.library' offset is -114.
  573.  
  574.    _LOCK=-84            The Lock function 'dos.library' offset is -84.
  575.  
  576.    _UNLOCK=-90          The UnLock function 'dos.library' offset is -90.
  577.  
  578.    Dreg(1)=Varptr(NAME$)    Put the address of the variable NAME$ in data
  579.                 register D1.
  580.  
  581.    Dreg(2)=Varptr(_MODE)    Put the access mode into data register D2.
  582.  
  583.    FILELOCK=Doscall(_LOCK)  Call Lock. FILELOCK should now hold the lock to
  584.                 the file we require. This prevents other
  585.                 programs from altering our file while we have
  586.                 access.
  587.  
  588.    Dreg(1)=FILELOCK         Place this lock into register D1.
  589.  
  590.    Dreg(2)=Start(10)        Tell the function where to place the InfoData
  591.                 structure.
  592.  
  593.    R=Doscall(_INFO)         Call Info. The 40 bytes reserved in Bank 10
  594.                 should now contain the data retrieved about our
  595.                 disk by the Info function.
  596.  
  597.    DREG(1)=FILELOCK         Once we have finished with the file it is
  598.                 considered polite to release our lock and thus
  599.    R=Doscall(_UNLOCK)       give other programs full access to it.
  600.  
  601.  
  602.  
  603.  
  604. e.g.
  605.     INFO["df0:"]
  606.  
  607.     Print "NumSoftErrors:   ";Leek(Start(10))
  608.     Print "Unit Number:     ";Leek(Start(10)+4)
  609.     Print "Disk State:      ";Leek(Start(10)+8)
  610.     Print "Num Blocks:      ";Leek(Start(10)+12)
  611.     Print "Blocks Used:     ";Leek(Start(10)+16)
  612.     Print "Bytes per Block: ";Leek(Start(10)+20)
  613.     Print "Disk Type:       ";Leek(Start(10)+24)
  614.     Print "VolumeNode:      ";Leek(Start(10)+28)
  615.     Print "In Use:          ";Leek(Start(10)+32)
  616.  
  617.  
  618.  
  619. ===================================================================
  620.  
  621.     To include in your own programs, simply cut and merge as
  622.     ASCII.
  623.  
  624.  
  625. Procedure INFO[NAME$]
  626.    Erase 10
  627.    Reserve As Work 10,40
  628.    _MODE=-2
  629.    _LOCK=-84
  630.    _UNLOCK=-90
  631.    _INFO=-114
  632.    Dreg(1)=Varptr(NAME$)
  633.    Dreg(2)=Varptr(_MODE)
  634.    FILELOCK=Doscall(_LOCK)
  635.    Dreg(1)=FILELOCK
  636.    Dreg(2)=Start(10)
  637.    R=Doscall(_INFO)
  638.    Dreg(1)=FILELOCK
  639.    R=Doscall(_UNLOCK)
  640. End Proc
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.    (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 ))
  651.  
  652.  
  653.